//
//  AppDelegate.m
//  JQUMSocialService
//
//  Created by JQZ on 2018/1/19.
//  Copyright © 2018年 JQ. All rights reserved.
//

#import "AppDelegate.h"
#import "JQUMSocialService.h"

/// UMeng
#define     UMENG_APPKEY        @"YOUR UMENG_APPKEY"

/// 微信
#define     WECHAT_APP_KEY      @"YOUR WECHAT_APP_KEY"
#define     WECHAT_APP_SECRET   @"YOUR WECHAT_APP_SECRET"
#define     WECHAT_REDIRECT_URL @"YOUR WECHAT_REDIRECT_URL"

/// QQ
#define     QQ_APP_KEY          @"YOUR QQ_APP_KEY"
#define     QQ_APP_SECRET       @"YOUR QQ_APP_SECRET"
#define     QQ_REDIRECT_URL     @"YOUR QQ_REDIRECT_URL"

/// 微博
#define     WB_APP_KEY          @"YOUR WB_APP_KEY"
#define     WB_APP_SECRET       @"YOUR WB_APP_SECRET"
#define     WB_REDIRECT_URL     @"YOUR WB_REDIRECT_URL"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    ///------------------------------------------------------------------------------------------┐
    // This file is NOT neccessary. You can use JQSOAppDelegate directly, without any subclasses.│
    ///------------------------------------------------------------------------------------------┘
    // Do something before all other app services
    // ...
    [self initServices:launchOptions];
    
    // JQSOAppDelegate (the super) does not implement -application:didFinishLaunchingWithOptions: actually.
    // It forwards the message to all registered services.
    // You MUST call super to ensure all registered service implementation get called.
    if ([super respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
        [super application:application didFinishLaunchingWithOptions:launchOptions];
    }
    
    return YES;
}

- (void)initServices:(NSDictionary *)launchOptions
{
    [[JQUMSocialService sharedInstance] setUmSocialAppkey:UMENG_APPKEY];
    [[JQUMSocialService sharedInstance] setPlaform:UMSocialPlatformType_WechatSession
                                            appKey:WECHAT_APP_KEY
                                         appSecret:WECHAT_APP_SECRET
                                       redirectURL:WECHAT_REDIRECT_URL];
    [[JQUMSocialService sharedInstance] setPlaform:UMSocialPlatformType_QQ
                                            appKey:QQ_APP_KEY
                                         appSecret:QQ_APP_SECRET
                                       redirectURL:QQ_REDIRECT_URL];
    [[JQUMSocialService sharedInstance] setPlaform:UMSocialPlatformType_Sina
                                            appKey:WB_APP_KEY
                                         appSecret:WB_APP_SECRET
                                       redirectURL:WB_REDIRECT_URL];
}

@end
